# -*- encoding: utf-8 -*-
import cv2


class Button(object):
    def __init__(self, pos, text, size=[85, 85]):
        self.pos = pos
        self.size = size
        self.text = text


class ImgButton(object):
    def __init__(self, w, h):
        self.buttonList = []
        center_y = int(h / 2)
        self.buttonList.append(Button(
            (150, int(center_y - 80)),
            "ocr",
            size=[120, 50],
        ))

        self.buttonList.append(Button(
            (150, int(center_y + 10)),
            "rec",
            size=[120, 50],
        ))

        self.buttonList.append(Button(
            (150, int(center_y + 100)),
            "clr",
            size=[120, 50],
        ))

        self.text = ""
        self.width = w
        self.height = h

    def draw(self, img):
        for button in self.buttonList:
            x, y = button.pos
            w, h = button.size
            # print(x, y, w, h)
            cv2.rectangle(img, button.pos, (x + w, y + h), (200, 200, 255), cv2.FILLED)
            cv2.putText(img, button.text, (x + 15, y + 35), cv2.FONT_HERSHEY_PLAIN, 3, (255, 255, 255), 2)

        return img
